<?php
require '../config.php';
require CAMINHO_SERVIDOR . 'funcoes.php';
require 'login.class.php';
$login = new Login();
if ($login->verificar()) {
    ?>
    <!DOCTYPE html>
    <html lang="pt">
        <head>
            <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
            <meta charset="utf-8">
            <title>Area administrativa</title>
            <meta name="generator" content="Bootply" />
            <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
            <link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
            <style type="text/css">
                .navbar-static-top {
                    margin-bottom:20px;
                }
                i {
                    font-size:16px;
                }
                .nav > li > a {
                    color:#787878;
                }
                footer {
                    margin-top:20px;
                    padding-top:20px;
                    padding-bottom:20px;
                    background-color:#efefef;
                }
                /* count indicator near icons */
                .nav>li .count {
                    position: absolute;
                    bottom: 12px;
                    right: 6px;
                    font-size: 9px;
                    background: rgba(51,200,51,0.55);
                    color: rgba(255,255,255,0.9);
                    line-height: 1em;
                    padding: 2px 4px;
                    -webkit-border-radius: 10px;
                    -moz-border-radius: 10px;
                    -ms-border-radius: 10px;
                    -o-border-radius: 10px;
                    border-radius: 10px;
                }
                /* indent 2nd level */
                .list-unstyled li > ul > li {
                    margin-left:10px;
                    padding:8px;
                }
            </style>
        </head>
        <body>
            <div id="top-nav" class="navbar navbar-inverse navbar-static-top">
                <div class="container-fluid">
                    <div class="navbar-header">
                        <a class="navbar-brand" href="#">Bolão - Area Administrativa</a>
                    </div>
                    <div class="navbar-collapse collapse">
                        <ul class="nav navbar-nav navbar-right">
                            <li><a href="#"><i class="glyphicon glyphicon-user"></i> <?php echo ucfirst($LoginUsuario); ?></a></li>
                            <li><a href="logout.php"><i class="glyphicon glyphicon-lock"></i> Logout</a></li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-3">
                        <a href="#"><strong><i class="glyphicon glyphicon-wrench"></i> Ferramentas</strong></a>  
                        <hr>
                        <ul class="list-unstyled">
                            <li class="nav-header"> <a href="#" data-toggle="collapse" data-target="#menu1">
                                    <h5>Cadastrar <i class="glyphicon glyphicon-chevron-down"></i></h5>
                                </a>
                                <ul class="list-unstyled collapse in" id="menu1">
                                    <li class="active"> <a href="?view=campFase1"><i class="glyphicon glyphicon-tasks"></i> Campeonato</a></li>
                                    <li class="active"> <a href="?view=cadjogo"><i class="glyphicon glyphicon-book"></i> Jogo</a></li>
                                    <li class="active"> <a href="?view=cadtime"><i class="glyphicon glyphicon-flag"></i> Time</a></li>
                                    <li><a href="?view=cadusuario"><i class="glyphicon glyphicon-user"></i> Usuário</a></li>
                                    <li><a href="logout.php"><i class="glyphicon glyphicon-off"></i> Logout</a></li>
                                </ul>
                            </li>
                            <li class="nav-header"> <a href="#" data-toggle="collapse" data-target="#menu2">
                                    <h5>Listar <i class="glyphicon glyphicon-chevron-right"></i></h5>
                                </a>
                                <ul class="list-unstyled collapse" id="menu2">
                                    <li class="active"> <a href="#"><i class="glyphicon glyphicon-tasks"></i> Campeonatos</a></li>
                                    <li class="active"> <a href="#"><i class="glyphicon glyphicon-book"></i> Jogos</a></li>
                                    <li class="active"> <a href="#"><i class="glyphicon glyphicon-flag"></i> Times</a></li>
                                    <li class="active"> <a href="#"><i class="glyphicon glyphicon-inbox"></i> Apostas</a></li>
                                </ul>
                            </li>
                        </ul>
                        <hr>
                    </div>

                    <?php
                    if (isset($_GET['view'])) {
                        $pagina = $_GET['view'];
                        switch ($pagina) {
                            case "campFase1":
                                include './view/campFase1.php';
                                break;
                            case "campFase2":
                                include './view/campFase2.php';
                                break;
                            case "campLista":
                                include './view/campLista.php';
                                break;
                        }
                    }
                    ?>
                </div>
            </div>
            <script type='text/javascript' src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
            <script type='text/javascript' src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
            <!-- JavaScript jQuery code from Bootply.com editor  -->
            <script type='text/javascript'>

                $(document).ready(function () {
                    $(".alert3").addClass("in").fadeOut(4500);
                    /* swap open/close side menu icons */
                    $('[data-toggle=collapse]').click(function () {
                        // toggle icon
                        $(this).find("i").toggleClass("glyphicon-chevron-right glyphicon-chevron-down");
                    });

                });

            </script>
        </body>
    </html>
    <?php
} else {
    header("Location: " . URL_ADMIN);
}
